// pages/admin/index.js
import {request} from '../../request'
Page({
    data: {
        PageCur: 'menu'
    },
    onLoad: function () {
      var token = wx.getStorageSync('token');
      if (token == null || token == '') {
        wx.redirectTo({
          url: '../login/index',
        })
      } else {
        request('/getInfo', "GET").then(resopnse => {
          wx.setStorageSync('roles', resopnse.roles);
          wx.setStorageSync('userId', resopnse.user.userId);
        });
      }
    },
    toPages:function(roles){
      if(roles.includes('admin')){
        
      }else if(roles.includes('manager')){
  
      }else if(roles.includes('reception')){
        
      }else if(roles.includes('teacher')){
        
      }else if(roles.includes('member')){
        
      }
    },

    NavChange(e) {
        this.setData({
            PageCur: e.currentTarget.dataset.cur
        })
    }
})